﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;

namespace SchoolManagementSystem.Report._2._ThuQuy
{
    public partial class SoQuy : DevExpress.XtraReports.UI.XtraReport
    {
        public int TonDauKyVND;
        public int TonDauKyUSD;
        public SoQuy()
        {
            InitializeComponent();
        }

        public int a = 0;
        int indexgroup = 0;
        int lasttonvnd = 0;
        int lasttonusd = 0;
        private void GroupHeader1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            var month = GetCurrentColumnValue("Month");
            var year = GetCurrentColumnValue("Year");
           
            if (month != null && year != null)
            {
                xrTableCell_sodu.Text ="Số dư đầu tháng "+month+"/"+year;
            }
            indexgroup++;
            if (indexgroup == 1)
            {

                xrTableCell_tondaukyusd.Text = Helper.StringHelper.FormatCurrencyUS(TonDauKyUSD);
                xrTableCell_tondaukyvnd.Text = Helper.StringHelper.FormatVND(TonDauKyVND);
            }
            else
            {
                ////int tonvnd = 0;
                //if (GetCurrentColumnValue("MoneyThuVNInt").ToString() == "0")
                //{
                //    lasttonvnd = lasttonvnd + int.Parse(GetCurrentColumnValue("MoneyChiVNInt").ToString());
                //}
                //else if(GetCurrentColumnValue("MoneyChiVNInt").ToString()=="0")
                //{
                //    lasttonvnd = lasttonvnd - int.Parse(GetCurrentColumnValue("MoneyThuVNInt").ToString());
                //}
                xrTableCell_tondaukyvnd.Text = Helper.StringHelper.FormatVND(lasttonvnd);
                xrTableCell_tondaukyusd.Text = Helper.StringHelper.FormatCurrencyUS(lasttonusd); 
               // xrTableCell_tondaukyvnd.Text = "";
            }
           
        }

        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            try {
              
               
                lasttonvnd = int.Parse(GetCurrentColumnValue("MoneyInStockVN").ToString());
                lasttonusd = int.Parse(GetCurrentColumnValue("MoneyInStockUSD").ToString());
               
            }
            catch { }
        }

      

    }
}
